import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		tagNames:[],
		searchForm: {
			communityName: null,
			ventricleNumber: null,
			unitNumber: null
		},
		rentFilter: {
			rentForm: {
				start: '',
				end: ''
			},
			rentalRange: "",
			isDisabled: true,
			curSort: ""
		},
		flagState: false,
	},
	mutations: {
		changeFlagState(state, value) {
			console.log('执行');
			return state.flagState = true
		},
		changetagNames(state, value) {
		       
			   return state.tagNames = value
		},
		clearSearchForm(state) {
			return state.searchForm = {
				communityName: null,
				ventricleNumber: null,
				unitNumber: null
			}
		},

		clearSearchRange(state) {
			return state.rentFilter = {
				rentForm: {
					start: '',
					end: ''
				},
				rentalRange: "",
				isDisabled: true,
				curSort: ""
			}
		},


		activeMoney(state) {
			console.log(state);
		},
		changerentalRange(state, value) {
			return state.rentFilter.rentalRange = value
		},
		clearRentalRange(state) {
			return state.rentFilter.rentalRange = ""
		},
		changeDisabled(state, bool) {
			return state.rentFilter.isDisabled = bool
		},
		changeCurSort(state, value) {
			return state.rentFilter.curSort = value
		}
	}

})

export default store